<?php

namespace app\course\validate\video;

use think\Validate;

/**
 * 用户验证
 */
class Video extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'mhm_id'         => 'require',
        'title'          => 'require',
        'cover'          => 'require',
        'scribing_price' => 'require',
        'price'          => 'require',
        'teacher_id'     => 'require'

    ];

    protected $field = [
        'title'          => '课程名称',
        'cover'          => '封面',
        'price'          => '销售价',
        'scribing_price' => '原价',
        'mhm_id'         => '机构',
        'teacher_id'     => '讲师'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'title.require'          => '请输入课程名称',
        'cover.mobile'           => '请上传封面',
        'price.require'          => '请输入售价',
        'scribing_price.require' => '请输入原价',
        'mhm_id.require'         => '请选择所属机构',
        'teacher_id.require'     => '请选择讲师'

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'list' => ['xxx'],
    ];

    public function sceneList()
    {
        return $this->only(['phone', 'verify'])->remove('phone', 'unique');
    }
}
